Report hardware config errors to PtpConfig status conditions#130
Report hardware config errors to PtpConfig status conditions#130gtannous-spec wants to merge 2 commits intok8snetworkplumbingwg:mainfrom
Conversation
|
Thanks for your PR, |
f3358bb to
1e5aba9
Compare
1e5aba9 to
53aefc3
Compare
There was a problem hiding this comment.
Can changes in here be condensed at all?
There was a problem hiding this comment.
You mean adding all the file changed to be condensed in pkg/plugin/plugin.go ?
There was a problem hiding this comment.
I mean does it need to be a 500 line change? Or is this something that overall can be done more concisely?
There was a problem hiding this comment.
The simpler way is letting daemon write the failure status in the ptpconfig.
However, the ptpconfig controller is disabled in the linuxptp daemon. So I'm trying to use dynamic client here to write to the status of the ptpconfig using the dynamic client library function UpdateStatus and just skipping the controller which is imo complicating it to 500 line change.
There was a problem hiding this comment.
migrated the logic to PR#152
It is slightly more condensed, if that makes more sense :)
There was a problem hiding this comment.
migrated the logic to PR#152 It is slightly more condensed, if that makes more sense :)
Ack, will close it
Hardware Plugin Validation & Status Reporting
Summary
This PR adds runtime validation for hardware plugin names in
PtpConfigand reports configuration errors directly to the PtpConfig CR status. When users accidentally misconfigure plugin names (e.g., typoe81instead ofe810), the daemon now:HardwarePluginConfigurationWarningconditionProblem
Previously, if a user made a typo in the hardware plugin configuration section of a
PtpConfig, the daemon would silently fail to configure the hardware but continue running. This made debugging configuration issues difficult.Example of a typo that would go unnoticed:
Solution
The
PluginManagernow validates plugin names against registered plugins and uses a dynamic client to update the PtpConfig status when errors are found.New Status Condition
Files Changed
pkg/plugin/plugin.goValidateAndReportPluginErrors()method to PluginManager with dynamic client status updatespkg/plugin/plugin_test.goValidateProfilePluginsfunctionpkg/daemon/daemon.gopkg/daemon/daemon_internal_test.gotest/ptpconfig-invalid-plugin-test.yamltest/ptpconfig-valid-plugin-test.yamlImplementation Details
PluginManager Changes (
pkg/plugin/plugin.go)RestConfigandNamespacefields for dynamic client creationValidateAndReportPluginErrors()- Main validation entry pointupdatePtpConfigStatusWithPluginError()- Adds warning conditionclearPtpConfigPluginWarning()- Removes warning when fixedremovePluginWarningCondition()- Helper for condition removalDaemon Integration (
pkg/daemon/daemon.go)applyNodePTPProfiles()after profiles are appliedTesting
Unit Tests
go test ./pkg/plugin/... -vIntegration Testing
[{ "type": "HardwarePluginConfigurationWarning", "status": "True", "reason": "InvalidPluginName", "message": "Profile 'test-invalid-plugin' contains unrecognized hardware plugin(s): [e81]. Valid plugins are: [e810 e825 e830 ntpfailover]" }]Notes